import { connect } from 'react-redux'
import Address from '../../../views/My/MyUtils/Address'

function mapStateToProps(state: any) {
    return {
        userInfo: state.user.userInfo,
        addressData: state.detail.addressData,
        defaultAddress: state.user.defaultAddress
    }
}

function mapDispatchToProps(dispatch: (obj: any) => void) {
    return {
        'SET_DETAIL_ADDRESS': (data: any) => {
            dispatch({ type: 'SET_DETAIL_ADDRESS', data })
        },
        'SET_NEW_ADDRESS': (data: any) => {
            dispatch({ type: 'SET_NEW_ADDRESS', data })
        },
        'SET_USER_DEFAULT_ADDRESS': (data: any) => {
            dispatch({ type: 'SET_USER_DEFAULT_ADDRESS', data })
        }
    }
}

export default connect(mapStateToProps, mapDispatchToProps)(Address)